#!/bin/sh
#
# functions common to several scripts
#
TIME=$(date +%Y.%m.%d-%H%M)

function bak_dir() {
    local ret=0

    if [ -d ${1} ]; then
        ret=1
        echo -n "Backing up old \'${1}\'..."
        mv ${1}{,_${TIME}}
        echo "Done."
    fi

    return $ret
}

function chk_cmd() {
    which ${1} &>/dev/null || return 1
}

function rmv_word() {
	sed "s|${2}||g" ${1} > newfile && rm ${1} && mv newfile ${1}
}

# EOF
